package com.com;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class TestMainLocker {

	static Lock locker = new ReentrantLock();
	
	public static void main(String[] args) {

		print(0);
		
	}
	
	public static void print(int i){
		
		locker.lock();
		try {
			if ( i == 10){
				return;
			}
			
			System.out.println(i);
			
			print(++i);
			
		} finally {
			locker.unlock();
		}
		
	}

}
